/*
 * @Author: xiaosihan
 * @Date: 2024-09-22 14:27:15
 * @Last Modified by: xiaosihan
 * @Last Modified time: 2024-09-22 14:49:30
 */
import projectCollaborationApi from "@api/projectCollaborationApi";
import { ProjectCollaborationData } from "@type";
import { get } from "lodash";
import { observable, configure } from "mobx";
configure({ enforceActions: "never" });

const allProjectStore = observable(
  {
    total: 0, //总数
    list: [] as Array<ProjectCollaborationData>, //项目列表
    //请求项目
    async getList() {
      const res = await projectCollaborationApi.get(1, 99999);
      const data = get(res, ["data", "data"]);
      this.list = data; // 项目列表数据
      this.total = parseInt(get(res, ["data", "totalCount"]));
    },

    activeProjectId: "",
    setActiveProjectId(id: string) {
      this.activeProjectId = id;
    },
  },
  {},
  { deep: false }
);
export default allProjectStore;
